package com.oracle.failback;

import com.oracle.application.vo.R;
import com.oracle.feign.CartFeign;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

@Component
public class FailBackVo implements FallbackFactory<CartFeign> {
        @Override
        public CartFeign create(Throwable throwable) {
                return new CartFeign() {
                        @Override
                        public R addCart(@RequestParam(value = "bookId") Integer bookId, @RequestParam(value = "buyNum") Integer buyNum, @RequestParam("token") String token) {
                                return new R(201,"服务调用错误，请稍后重试",null);
                        }

                        @Override
                        public R delCart(Integer bookId) {
                                return new R(201,"服务调用错误，请稍后重试",null);
                        }
                };
        }
}
